package com.es.elasticsearch.controller;

import com.es.elasticsearch.dao.es.EsBlogDao;
import com.es.elasticsearch.dao.mysql.BlogDao;
import com.es.elasticsearch.model.es.EsBlog;
import com.es.elasticsearch.model.mysql.MysqlBolg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Iterator;
import java.util.List;

/**
 * @Auther: Administrator
 * @Date: 2019-12-30 15:34
 * @Description:
 */
@Controller
public class IndexController {

    @Autowired
    BlogDao blogDao;

    @Autowired
    EsBlogDao esBlogDao;

    @RequestMapping("/")
    public String index (){
        List<MysqlBolg> all = blogDao.findAll();
        Iterable<EsBlog> all1 = esBlogDao.findAll();
        Iterator<EsBlog> iterator = all1.iterator();
        EsBlog esBlog = iterator.next();
        //测试
        System.out.println(all.size());
        System.out.println(esBlog);
        return "index.html";
    }
}



